feat(library): vendor the TypeScript SDK library and build its bundle - #21
Closed
TomChv wants to merge 2 commits into
Closed
feat(library): vendor the TypeScript SDK library and build its bundle#21TomChv wants to merge 2 commits into
TomChv wants to merge 2 commits into
Conversation
TomChv
force-pushed
the
feat/vendor-typescript-library
branch
2 times, most recently
from
August 25, 2026 16:06
9bf3ea6 to
faa86e5
Compare
TomChv
marked this pull request as ready for review
August 25, 2026 16:15
eunomie
approved these changes
Aug 26, 2026
TomChv
force-pushed
the
feat/vendor-typescript-library
branch
from
August 28, 2026 11:24
faa86e5 to
fbde40a
Compare
Module bindings import their runtime from ./core.js, a bundle that until now only existed inside the engine image — which is why this repo could generate a module's bindings but not the library they run against. Vendor the library and build the bundle here instead. The source is dagger/dagger's sdk/typescript at v1.0.0-beta.9, the engine these checks run against, minus what does not belong to the library itself: the Go runtime module (which stays upstream), the test and lint tooling, the upstream changelog, and its dagger.json — a stray module config here would be discovered as a workspace module. src/api/client.gen.ts is left out too; the packager already generates it. A copy has no merge base git can compute, so the one it would have had is written down: library/VENDOR.md records the tag, the commit, what was left behind, the exhaustive list of local deltas, and the re-import procedure. Without it a re-vendor is a blind overwrite, and these deltas are small enough to lose without noticing. The inherited README is replaced for the same reason — it described an npm workflow, in a directory that has none. libraryBundle builds core.js and core.d.ts with the same commands and the same pinned bun image as toolchains/engine-dev/build/sdk.go, so a module built against this bundle behaves like one built against the engine's. Verified: it exports the runtime the generated bindings import (Context, BaseClient) and the decorators modules are written with (object, func, field, enumType, entrypoint, ...). The declaration build takes the compiler the lockfile resolves, via `bun x`, rather than a globally installed one. A global `bun install -g typescript` is whatever the registry served that day, so the .d.ts we ship could move on an unchanged tree — the one part of the bundle that would not be reproducible. The bundle is committed rather than built on demand: the SDK reads it at generate time, and building it there would put a bun toolchain in the critical path of every `dagger generate`. Signed-off-by: Tom Chauveau <tom@dagger.io>
TomChv
force-pushed
the
feat/vendor-typescript-library
branch
from
August 28, 2026 12:26
fbde40a to
b95daa3
Compare
The vendored scripts all pointed at things this repo does not have: mocha, eslint and tsx were left behind with the tests they serve, and the docs scripts reach for ../../docs/current_docs. Only `build` was live, and the packager already runs tsc itself. Drop them, and trim devDependencies and resolutions to what the bundle build actually uses (rollup, rollup-plugin-dts, the @types the declaration build needs) so package.json describes the package while the packager owns how it is built. Keep yarn.lock: it is load-bearing, not vendored ceremony. Installing without it resolves newer transitives and grows core.js from 4.3 MB to 5.4 MB, so the bundle would silently stop matching the one the engine ships. Signed-off-by: Tom Chauveau <tom@dagger.io>
TomChv
force-pushed
the
feat/vendor-typescript-library
branch
from
August 28, 2026 13:17
b95daa3 to
f16bdbd
Compare
Member
Author
|
Superseded by #39, which squashes this whole stack into a single PR off The stack had PRs overwriting each other — this one included — which made the intermediate states hard to reason about, and thirteen PRs each fanning out a full check suite made CI unreadable. Branch is left pushed, so nothing here is lost. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Module bindings import their runtime from ./core.js, a bundle that until now
only existed inside the engine image — which is why this repo could generate a
module's bindings but not the library they run against. Vendor the library and
build the bundle here instead.
The source is dagger/dagger's sdk/typescript at v1.0.0-beta.9, the engine these
checks run against, minus what does not belong to the library itself: the Go
runtime module (which stays upstream), the test and lint tooling, the upstream
changelog, and its dagger.json — a stray module config here would be discovered
as a workspace module. src/api/client.gen.ts is left out too; the packager
already generates it.
libraryBundle builds core.js and core.d.ts with the same commands and the same
pinned bun image as toolchains/engine-dev/build/sdk.go, so a module built
against this bundle behaves like one built against the engine's. Verified: it
exports the runtime the generated bindings import (Context, BaseClient) and the
decorators modules are written with (object, func, field, enumType, entrypoint,
...).
The bundle is committed rather than built on demand: the SDK reads it at
generate time, and building it there would put a bun toolchain in the critical
path of every
dagger generate.Signed-off-by: Tom Chauveau tom@dagger.io
Stack created with GitHub Stacks CLI • Give Feedback 💬